﻿using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

using SUMO.MediaBrowser.ViewModel;

namespace SUMO.MediaBrowser.ViewModel
{
    public class EditingHierarchicalMediaItem : INotifyPropertyChanged
    {
        public EditingHierarchicalMediaItem(HierarchicalMediaItem item)
        {
            _item = item;
        }

        HierarchicalMediaItem _item;
        public HierarchicalMediaItem Item
        {
            get { return _item; }
            set
            {
                _item = value;
                OnPropertyChanged("Item");
            }
        }

        byte[] _workingData = null;
        public byte[] WorkingData
        {
            get
            {
                if (_workingData == null)
                    _workingData = Item.ItemData.Clone() as byte[];
                return _workingData;
            }
            set
            {
                if (value == _workingData)
                    return;
                _workingData = value;
                OnPropertyChanged("WorkingData");
            }

        }

        #region INotifyPropertyChanged Members

        public event PropertyChangedEventHandler PropertyChanged;
        protected void OnPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }
        #endregion
    }
}
